package com.adminlab.model
{
	import com.adminlab.managers.PersistenceManager;
	import com.adminlab.vos.ExamType;
	import com.adminlab.vos.ExamTypeSummary;
	
	import flash.events.IEventDispatcher;
	import flash.utils.Dictionary;
	
	import mx.collections.ArrayCollection;
	
	public class ReportModel extends BaseModel
	{

		[Bindable]
		public var examTypeSummarys:ArrayCollection;
		
		[Bindable]
		public var examTypes:Dictionary;

		[Bindable]
		public var persistenceManager:PersistenceManager;

		public function ReportModel(target:IEventDispatcher=null)
		{
			super(target);
		}
		
		public function getExamType( examTypeSummary:ExamTypeSummary ):ExamType
		{
			var examType:ExamType = examTypes[ examTypeSummary.code ];
			
			if( !examType )
			{
				examType = persistenceManager.getExamType( examTypeSummary );
			}
			
			return examType;
		}	
	}
}